﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 行情显示.枚举;

namespace 行情显示.数据模板.Models
{
    public class 行情 : Caliburn.Micro.PropertyChangedBase
    {
        private bool _isChecked;
        public bool IsChecked
        {
            get => this._isChecked;
            set => this.Set(ref this._isChecked, value);
        }

        private 股票类型 _goodType;
        public 股票类型 GoodType
        {
            get => this._goodType;
            set => this.Set(ref this._goodType, value);
        }

        private string _title;
        public string Title
        {
            get => this._title;
            set => this.Set(ref this._title, value);
        }

        private decimal? _price;
        public decimal? Price
        {
            get => this._price;
            set
            {
                this.BrushPrice = this._price > value ? FailBrush : this._price == value ? NormalBrush : RiseBrush;
                this.Set(ref this._price, value);
            }
        }

        private long? _stock;
        public long? Stock
        {
            get => this._stock;
            set
            {
                this.BrushStock = this._stock > value ? FailBrush : this._stock == value ? NormalBrush : RiseBrush;
                this.Set(ref this._stock, value);
            }
        }

        private decimal? _prePrice;
        public decimal? PrePrice
        {
            get => this._prePrice;
            set
            {
                this.BrushPrePrice = this._prePrice > value ? FailBrush : this._prePrice == value ? NormalBrush : RiseBrush;
                this.Set(ref this._prePrice, value);
            }
        }

        private long? _preStock;
        public long? PreStock
        {
            get => this._preStock;
            set
            {
                this.BrushPreStock = this._preStock > value ? FailBrush : this._preStock == value ? NormalBrush : RiseBrush;
                this.Set(ref this._preStock, value);
            }
        }

        readonly string NormalBrush = "Black";
        readonly string FailBrush = "Green";
        readonly string RiseBrush = "Red";

        private string _brushPrice;
        public string BrushPrice
        {
            get => this._brushPrice;
            set => this.Set(ref this._brushPrice, value);
        }

        private string _brushStock;
        public string BrushStock
        {
            get => this._brushStock;
            set => this.Set(ref this._brushStock, value);
        }

        private string _brushPrePrice;
        public string BrushPrePrice
        {
            get => this._brushPrePrice;
            set => this.Set(ref this._brushPrePrice, value);
        }

        private string _brushPreStock;
        public string BrushPreStock
        {
            get => this._brushPreStock;
            set => this.Set(ref this._brushPreStock, value);
        }

        public 行情()
        {
            this.Price = null;
            this.Stock = null;
            this.PrePrice = null;
            this.PreStock = null;
        }
    }
}
